#https://leetcode.cn/leetbook/read/array-and-string/cxqdh/
#2024/10/11
class Solution:
    def searchInsert(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: int
        """
        for i in range(len(nums)):
            if target==nums[i]:
                return i
            if target<nums[i]:
                return i            
        return i+1
        

#2024/11/14
    def searchInsert1(self, nums, target):
        for i in range(len(nums)):
            if target<=nums[i]:
                return i
        return i+1
nums = [1,3,5,6]
target=5
target1=2
target2=7
solution=Solution()
print(solution.searchInsert(nums,target))
print(solution.searchInsert(nums,target1))
print(solution.searchInsert(nums,target2))
print(solution.searchInsert1(nums,target))
print(solution.searchInsert1(nums,target1))
print(solution.searchInsert1(nums,target2))

